package com.xjy.headfirst.适配器模式;

import org.apache.commons.lang3.StringUtils;

import java.util.Iterator;
import java.util.List;

/**
 * decription: 完成适配器ArrayList案例
 *
 * @author 辛纪元
 * @since 2022-07-13
 */

public class TestArratyList implements Iterator<Object> {

    List<String> list;

    int temp = 0;

    public TestArratyList(List<String> list) {
        this.list = list;
    }

    @Override
    public boolean hasNext() {
        return StringUtils.isNotEmpty(list.get(temp));
    }

    @Override
    public Object next() {
        return StringUtils.isNotEmpty(list.get(temp)) ? list.get(temp) : null;
    }
}
